package com.personalblog.mapper;

import com.personalblog.dto.BlogQuery;
import com.personalblog.po.Blog;
import com.personalblog.po.Tag;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author jxau_scf
 * @date 2021/3/23 - 22:50
 */
@Repository
public interface BlogMapper {
    int insertBlog(Blog blog);
    int deleteBlog(int blogId);
    int updateBlog(Blog blog);
    Blog findBlogById(int blogId);
    List<Blog> findBlogs();
    List<Blog> findBlogsByTagId(int tagId);
    List<Blog> findBlogsByTypeId(int typeId);
    List<Blog> findBlogsByBlogQuery(BlogQuery blogQuery);
    int findBlogCount();
//    Blog findBlogFetchType(int blogId);
    int insertBlogTag(@Param("blogId") Integer blogId, @Param("tagIdList") List<Integer> tagIdList);
    int deleteBlogTagByBlogId(int blogId);
    List<Blog> findBlogsOrderByUpdateTime(int pageSize);
    List<Blog> findBlogsByKeywordQuerySearch(@Param("query") String query);
    int updateBlogViews(int blogId);
    List<String> findGroupYear();
    List<Blog> findBlogsByYear(@Param("year") String year);
}
